from selenium import webdriver
# 隐藏式
# browser = webdriver.Chrome()
# browser.implicitly_wait(10)
# browser.get('https://dynamic2.scrape.center/')
# input = browser.find_element_by_class_name('logo-image')
# print(input)

# 显式等待
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

browser = webdriver.Chrome()
browser.get('https://www.taobao.com/')
wait = WebDriverWait(browser, 10)  # 指定等待时间
input = wait.until(EC.presence_of_element_located((By.ID, 'q')))  # 使用until的方法，传入要等待的参数expected_conditions
button = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '.btn-search')))
print(input, button)
